package field_method09;

import java.util.ArrayList;

public class StudentTest {
    public static void main(String[] args) {
        //容器
        ArrayList<Student> list = new ArrayList<>();
        list.add(new Student(1,"张三"));
        list.add(new Student(2,"李四"));
        list.add(new Student(3,"王五"));
        for (int i = 0; i < list.size(); i++){

            Student s = list.get(i);
            if (s.getName().equals("张三")){
                s.setName("张三丰");
            }
            if (s.getName().equals("王五")){
                list.remove(s);

            }


        }

        //数据
        //
        //
        for (int i = 0; i < list.size();i++){
            System.out.println(list.get(i));
        }

    }
}
